package com.situ.day3;

import java.util.Scanner;

import org.junit.Test;

public class OOPDemo {

	public static void main(String[] args) {
		Student student1 = new Student();
		student1.id = 1;
		student1.name = "zhangsan";
		student1.age = 18;
		student1.className = "Java1812";
		student1.study();
		
		Student student2 = new Student();
		student2.id = 2;
		student2.name = "lisi";
		student2.age =  20;
		student2.className = "UI";
		student2.study();
		
		Teacher teacher = new Teacher();
		teacher.id = 3;
		teacher.name = "wangwu";
		teacher.age = 30;
		teacher.salary = 7777;
		teacher.teach();
	}
	
	
	@Test
	public void test1() {
		System.out.println("请输入学生数量：");
		Scanner scanner = new Scanner(System.in);
		int count = scanner.nextInt();
		Student[] students = new Student[count];
		for (int i = 0; i < students.length; i++) {
			//每次遍历时候构造一个student对象
			Student student = new Student();
			System.out.println("请输入学生id：");
			student.setId(scanner.nextInt());
			System.out.println("请输入学生name：");
			student.name = scanner.next();
			System.out.println("请输入年龄：");
			student.age = scanner.nextInt();
			System.out.println("请输入班级：");
			student.className = scanner.next();
			//输入相应信息之后将student对象放到数组对应下标位置
			students[i] = student;
		}
		
		for (int i = 0; i < students.length; i++) {
			Student student = students[i];
			// Ctrl+Shift+/
			/*System.out.println(student.id);
			System.out.println(student.name);
			System.out.println(student.age);
			System.out.println(student.className);*/
			System.out.println(student.toString());
			System.out.println(student);
		}
	}
	
	@Test
	public void test555() {
		Student student = new Student();
		//student.id = 1;
		student.setId(1);
		
		Student student2 = new Student(1, "zhansgan", 20, "Java1812");
		System.out.println(student2.getId());
		String str = student2.toString();
		System.out.println(str);
	}
	
	@Test
	public void test333() {
		Student student = new Student(1, "zhansgan", 20, "Java1812");
		System.out.println(student.getName());
		student.setName("zhangsan111");
		System.out.println(student.getName());
	}
	
	@Test
	public void test111() {
		Teacher teacher = new Teacher();
		//teacher.id = 1;
		teacher.setId(111);
		int id = teacher.getId();
		System.out.println(teacher.getId());
		
		Teacher teacher2 = new Teacher(2, "lisi", 23, 10000);
		System.out.println(teacher2.getId());
		System.out.println(teacher2);
	}
	
	
	
	
	
}
